<?php
namespace App\Http\Controllers\Wx;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Models\Product;

class ProductController extends Controller
{
    public function index(Request $request)
    {

    	$query = Product::query();
    	if($request->type) {
    		$query->where('type',$request->type);
    	}    	
    	$list = $query->orderBy('is_rec','desc')->paginate(10);
    	$rs['data'] = $list;
    	$rs['status'] = true;
    	return response()->json($rs);


    }

    public function show(Request $request)
    {
    	$id = $request->id;
    	$data = Product::find($id);
    	$rs['data'] = $data;
    	$rs['status'] = true;
    	return response()->json($rs);
    }
}
